home *** CD-ROM | disk | FTP | other *** search
/ The World of Computer Software / The World of Computer Software.iso / dfpp01.zip / SCREEN.H < prev    next >
C/C++ Source or Header  |  1992-11-21  |  1KB  |  47 lines

  1. // ----------- screen.h
  2.  
  3. #ifndef SCREEN_H
  4. #define SCREEN_H
  5.  
  6. #include <dos.h>
  7. #include "dflatdef.h"
  8. #include "rectangl.h"
  9.  
  10. class Screen    {
  11.     unsigned address;
  12.     unsigned mode;
  13.     unsigned page;
  14.     unsigned height;
  15.     unsigned width;
  16.     union REGS regs;
  17.     // ---- compute video offset address
  18.     unsigned vad(int x, int y) { return y * (width*2) + x*2; }
  19. public:
  20.     Screen();
  21.     unsigned Height() { return height; }
  22.     unsigned Width()  { return width; }
  23.     unsigned Page()   { return page; }
  24.     Bool isEGA();
  25.     Bool isVGA();
  26.     Bool isMono() { return (Bool) (mode == 7); }
  27.     Bool isText() { return (Bool) (mode < 4);  }
  28.     void Scroll(Rect &rc, int d, int fg, int bg);
  29.     unsigned int GetVideoChar(int x, int y);
  30.     void PutVideoChar(int x, int y, unsigned int c);
  31.     void WriteVideoString(char *s,int x,int y,int fg,int bg);
  32.     void GetBuffer(Rect &rc, char *bf);
  33.     void PutBuffer(Rect &rc, char *bf);
  34. };
  35.  
  36. const int VIDEO = 0x10;
  37.  
  38. inline int clr(int fg, int bg)
  39. {
  40.     return fg | (bg << 4);
  41. }
  42.  
  43. #endif
  44.  
  45.  
  46.  
  47.